package com.itheima.controller;

import com.itheima.domain.Book;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/books")
public class BookController {

    @PostMapping
    public String save(@RequestBody Book book ){
        System.out.println("book save"+book);
        return "{'module':''book save}";
    }
    @DeleteMapping("/{id}")
    public String delete(@PathVariable Integer id){
        System.out.println("book delete"+id);
        return "{'module':''book delete}";
    }
    @PutMapping
    public String update(@RequestBody Book book){
        System.out.println("book update"+book);
        return "{'module':''book update}";
    }
    @GetMapping("/{id}")
    public String getById(@PathVariable Integer id){
        System.out.println("book get"+id);
        return "{'module':''book get by id}";
    }

}
